/**
 * @description 商户配置
 *
 */
seajs.use(['zepto'], function($) {
	var index = {
		init:function(){
			this.channelId = this.GetQueryString('channelId');
			this.userId = this.GetQueryString('userId');
			this.bindEvent();
		},
		GetQueryString:function(name){
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = decodeURI(window.location.search).substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	 	},
		bindEvent:function(){
			var self = this;

			// 替换所有的a链接的url
			$('.list a').each(function(i,n){
				var url = $(n).attr('data-url')+'?isPeizhi=true&channelId='+self.channelId+'&userId='+self.userId;
				$(n).attr('href',url);
			});
		}
	}
	index.init();
});
